package org.dey.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.dey.pojo.CheckGroup;
import org.dey.pojo.CheckItem;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author hg
 * @date 2022/3/15
 * @classname
 */
@Repository
public interface CheckGroupMapper extends BaseMapper<CheckGroup> {

    //获取最后一条数据的检查项编号
    @Select(" SELECT code FROM t_checkgroup ORDER BY id DESC LIMIT 0,1")
    public CheckGroup getCheckGroup();

    @Insert("insert into t_checkgroup_checkitem values (#{id},#{id1}) ")
    int addjcztjjcx(@Param("id") int id,@Param("id1") Integer id1);

    @Select("select tc.* from t_checkgroup_checkitem a inner join t_checkitem tc on a.checkitem_id = tc.id where a.checkgroup_id=#{id}")
    List<CheckItem> kcjcx(int id);

    @Delete("Delete from t_setmeal_checkgroup where setmeal_id=#{id}")
    int xc(int id);
}
